﻿<Page x:Class="WpfBinding.ModelBinding"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
	Title="ModelBinding">
    <Canvas x:Name="gd">
        <Button  Content="Add" Margin="0,0,247,277" Click="Button_Click" Canvas.Left="205" Canvas.Top="12" Height="48" Width="54" />
        <ListBox Height="138" HorizontalAlignment="Left" Margin="75,95,0,0"  IsSynchronizedWithCurrentItem="True"
                 Name="listBox1" VerticalAlignment="Top" Width="94" Canvas.Left="-63" Canvas.Top="-18">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Age}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <ListBox Height="138" HorizontalAlignment="Left" Margin="75,95,0,0"   IsSynchronizedWithCurrentItem="True" 
                 Name="listBox2" VerticalAlignment="Top" Width="105" Canvas.Left="103" Canvas.Top="-18">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Age}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <TextBlock Height="30" Margin="178,0,74,211" Width="100" Name="textBlock1" Background="LightGray" 
                   Text="{Binding Path=Count,StringFormat=Total:{0}}" VerticalAlignment="Bottom" Canvas.Left="-166" Canvas.Top="41" />
        <TextBlock  Width="150" Height="30" x:Name="tb" Text="{Binding Path=Age,StringFormat=Current:{0}}" 
                    Background="LightCyan" Margin="12,0,138,211" VerticalAlignment="Bottom" Canvas.Left="0" Canvas.Top="4" />
    </Canvas>
</Page>